﻿<%@ Control Language="C#" AutoEventWireup="true" CodeFile="ProductDetails.ascx.cs" Inherits="UserControls_ProductDetails" %>
<%@Import namespace="ProductServiceReference" %>
<%@Import namespace="System.ServiceModel" %>
<%
    try
    {
        var client = new ProductServiceClient();
        var prodid = int.Parse(Request.QueryString["prodid"]);
        var product = client.GetProduct(prodid);
        %>
          <div id="tblprod">
				<div id="prod_details">
					<div id="prodovw">
						<img src="<%=product.ProductImage %>" alt="image" />
						<div>
							<strong><%=product.ProductName %></strong>
							<p>
								<b>Price:<%=product.Price %></b></p>
							<p>
								Đã bao gồm thuế VAT</p>
							<p>Tình trạng:
                            <%if (product.Quantity != 0)
                              {%>
                                    Còn hàng
                            <% }
                              else
                              {
                                 %>
                                 Het hang
                                 <%
                              } %>
                            </p>    
							<a href="BuyProduct.aspx?proid=<%=prodid %>">Buy</a>
							<asp:Button runat="server" ID="btnAddtoCart" Text="Add to cart" 
                                onclick="btnAddtoCart_Click"/>
						</div>
					</div>
					<p class="title">Thông tin chi tiết</p>
					<table>
						<tr>
							<td class="label">Origin</td>          <% //loi %>
							<td><%=product.Origin %></td>
						</tr>
						<tr>
							<td class="label">Guarantee period</td>
							<td><%=product.GuaranteePeriod%> years</td>
						</tr>
					</table>
				</div>
			</div>

        <%
    }
    catch (FaultException<Product> faultException)
    {
        
    }
    catch (Exception ex)
    {

    }
  
   %>
          